bitkeeper revision 1.1159.1.91 (4125c04fdFsBys6pCPgiqHACIMhgWQ)
authormjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Fri, 20 Aug 2004 09:11:43 +0000 (09:11 +0000)
committermjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Fri, 20 Aug 2004 09:11:43 +0000 (09:11 +0000)
Support NFS root by creating the block device controller for a domain
even when it has no disks.

tools/python/xen/xend/XendDomainInfo.py
tools/python/xen/xend/server/blkif.py

index 309521ef81f99b3f0f496ff07928a8fa197aed13..f394bdee66e0eb4ca74f810e4acddf71cfd9a18b 100644 (file)
@@ -466,7 +466,7 @@ class XendDomainInfo:
         # my domain id.
         if not dominfo:
             return
-        print 'check_name>', 'dom=', dominfo.name, dominfo.dom, 'self=', name, self.dom
+        #print 'check_name>', 'dom=', dominfo.name, dominfo.dom, 'self=', name, self.dom
         if dominfo.is_terminated():
             return
         if not self.dom or (dominfo.dom != self.dom):
@@ -922,12 +922,10 @@ class XendDomainInfo:
     def configure(self):
         """Configure a vm.
 
-        vm         virtual machine
-        config     configuration
-
-        returns Deferred - calls callback with vm
+        @return: deferred - calls callback with vm
         """
-        d = self.create_devices()
+        d = self.create_blkif()
+        d.addCallback(lambda x: self.create_devices())
         d.addCallback(self._configure)
         return d
 
@@ -942,16 +940,27 @@ class XendDomainInfo:
         d.addErrback(cberr)
         return d
 
+    def create_blkif(self):
+        """Create the block device interface (blkif) for the vm.
+        The vm needs a blkif even if it doesn't have any disks
+        at creation time, for example when it uses NFS root.
+
+        @return: deferred
+        """
+        ctrl = xend.blkif_create(self.dom, recreate=self.recreate)
+        back = ctrl.getBackend(0)
+        return back.connect(recreate=self.recreate)
+    
     def dom_construct(self, dom, config):
         """Construct a vm for an existing domain.
 
-        @param dom:    domain id
+        @param dom: domain id
+        @param config: domain configuration
         @return: deferred
         """
         d = dom_get(dom)
         if not d:
             raise VmError("Domain not found: %d" % dom)
-        print 'dom_construct>', dom, config
         try:
             self.restore = 1
             self.setdom(dom)
index 4a683610cb0d99d406aed276ce36d774348e43c6..00f19a805da44718f09857696b2cd91d93623837 100755 (executable)
@@ -15,6 +15,8 @@ from messages import *
 
 class BlkifBackendController(controller.BackendController):
     """ Handler for the 'back-end' channel to a device driver domain.
+    Must be connected using connect() before it can be used.
+    Do not create directly - use getBackend() on the BlkifController.
     """
 
     def __init__(self, ctrl, dom, handle):
@@ -287,7 +289,6 @@ class BlkifController(controller.SplitController):
     
     def __init__(self, factory, dom):
         """Create a block device controller.
-        The controller must be connected using connect() before it can be used.
         Do not call directly - use createInstance() on the factory instead.
         """
         controller.SplitController.__init__(self, factory, dom)